﻿<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>云监控</title>
		<meta name="keywords" content="Bootstrap模版,Bootstrap模版下载,Bootstrap教程,Bootstrap中文" />
		<meta name="description" content="站长素材提供Bootstrap模版,Bootstrap教程,Bootstrap中文翻译等相关Bootstrap插件下载" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<!-- basic styles -->
		<link href="/static/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="/static/css/font-awesome.min.css" />

		<!--[if IE 7]>
		  <link rel="stylesheet" href="/static/css/font-awesome-ie7.min.css" />
		<![endif]-->

		<!-- page specific plugin styles -->

		<!-- fonts -->

		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

		<!-- ace styles -->

		<link rel="stylesheet" href="/static/css/ace.min.css" />
		<link rel="stylesheet" href="/static/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="/static/css/ace-skins.min.css" />

		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="/static/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="/static/js/ace-extra.min.js"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="/static/js/html5shiv.js"></script>
		<script src="/static/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body>
		<div class="navbar navbar-default" id="navbar">
			<script type="text/javascript">
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
			</script>

			<div class="navbar-container" id="navbar-container">
				<div class="navbar-header pull-left">
					<a href="#" class="navbar-brand">
						<small>
							<i class="icon-leaf"></i>
							云监控
						</small>
					</a><!-- /.brand -->
				</div><!-- /.navbar-header -->

				<div class="navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
				

		

						

						<li class="light-blue">
							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
								  
								<span class="user-info">
									<small>你好,</small>
									Jason
								</span>

								<i class="icon-caret-down"></i>
							</a>

							<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<li>
									<a href="#">
										<i class="icon-cog"></i>
										设置
									</a>
								</li>

								<li>
									<a href="#">
										<i class="icon-user"></i>
										个人资料
									</a>
								</li>

								<li class="divider"></li>

								<li>
									<a href="#">
										<i class="icon-off"></i>
										退出
									</a>
								</li>
							</ul>
						</li>
					</ul><!-- /.ace-nav -->
				</div><!-- /.navbar-header -->
			</div><!-- /.container -->
		</div>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<div class="sidebar" id="sidebar">
					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
					</script>

					{% include "index_navlist.html" %}

					<div class="sidebar-collapse" id="sidebar-collapse">
						<i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
					</div>

					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
					</script>
				</div>

				<div class="main-content">
			 

					<div class="page-content">
					 

						<div class="row">
						
					<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->

								<div class="alert alert-info">
									<i class="icon-hand-right"></i>
									SSL监控项目
									<button class="close" data-dismiss="alert">
										<i class="icon-remove"></i>
									</button>
								</div> 
								<div class="widget-main">
									<a class="btn   btn-success" href="/project/create">
									 <i class="icon-edit bigger-130"> 添加监控项目</i>
										
									</a> 
								</div>
 
                        <td align="center">
						<table id="project-table" 
							class="table table-bordered table-condensed table-hover">
						</table>
					</td>

								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
								
						 </div><!-- /row -->

								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

				 
			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<!-- basic scripts -->
	<!--[if !IE]> -->

		<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='/static/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='/static/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='/static/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="/static/js/bootstrap.min.js"></script>
		<script src="/static/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->

		<script src="/static/js/date-time/bootstrap-datepicker.min.js"></script>
		<script src="/static/js/jqGrid/jquery.jqGrid.min.js"></script>
		<script src="/static/js/jqGrid/i18n/grid.locale-en.js"></script>

		<!-- ace scripts -->

	<script src="/static/js/jquery-ui-1.10.3.custom.min.js"></script>
	<script src="/static/js/jquery.ui.touch-punch.min.js"></script>
	<script src="/static/js/jquery.slimscroll.min.js"></script>
	<script src="/static/js/jquery.easy-pie-chart.min.js"></script>
	<script src="/static/js/jquery.sparkline.min.js"></script>
	<script src="/static/js/flot/jquery.flot.min.js"></script>
	<script src="/static/js/flot/jquery.flot.pie.min.js"></script>
	<script src="/static/js/flot/jquery.flot.resize.min.js"></script>
   <script src="/static/js/jquery.dataTables.min.js"></script>
	<!-- ace scripts -->

	<script src="/static/js/ace-elements.min.js"></script>
	<script src="/static/js/ace.min.js"></script>

	<script src="/static/js/bootbox.min.js"></script>
	<!-- inline scripts related to this page -->
	<script src="/static/js/highcharts.js"></script> 
	<script type="text/javascript">  
	function alert_msg(msg) { 
		  bootbox.alert({  
	            buttons: {  
	               ok: {  
	                    label: '返回',  
	                    className: 'btn-myStyle'  
	                }  
	            },  
	            message: msg,  
	            callback: function() {  
	            	location.reload();
	            },   
	        });  
	};
	function projectdel(id){
		bootbox.dialog({
			message: "<h3 class=\"   smaller lighter orange\" >确认删除监控项目?</h3>",
			buttons: 			
			{
				
				"button" :
				{
					"label" : "确定",
					"className" : "btn-sm",
					"callback": function() {
						jQuery
						.getJSON(
								'/project/delproject?id='+id,
								function(result) {
									if(result["result"])
									{
										alert_msg("成功");
										 
									}else
									{
										alert_msg("失败");
									}
								});

					}
				},
				"click" :
				{
					"label" : "取消",
					"className" : "btn-sm btn-danger"
				}
			}
		});
		
	};
	
	function getprojects()
	{
		jQuery
		.getJSON(
				'/project/getproject',
				function(result) {
					table = $("#project-table")
							.dataTable(
									{
										"bLengthChange" : true,
										"bInfo" : true,
										"aaSorting" : [ [
												3,
												"desc" ] ],
										"aoColumnDefs" : [ {
											"bVisible" : false,
											"aTargets" : [ 9]
										} ],
										"lengthMenu" : [
												20,
												50,
												100 ],
										"iDisplayLength" : 20,
										"bPaginate" : true, //翻页功能
										"bFilter" : true,
										"bAutoWidth" : false,
										"bSort" : true,
										'aaData' : result['data'],
										//"bRetrieve": true,
										"bDestroy" : true,
										// "oSearch":{ "sSearch": "", "bRegex": false, "bSmart": true },
										"oLanguage" : {
											"sInfo" : "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
											"oPaginate" : {
												"sFirst" : "首页",
												"sPrevious" : "前一页",
												"sNext" : "后一页",
												"sLast" : "尾页"
											},
											"sProcessing" : "<img src='/static/img/loading35.gif' />"
										},
										"aoColumns" : [
												{"sTitle" : "项目名称","mData" : "name"}, 
												{"sTitle" : "域名","mData" : "domain"},
												{"sTitle" : "端口","mData" : "port" },
												{"sTitle" : "检测间隔","mData" : "check_frequency" ,"mRender" : function(data,type,row) {
													
													 return data+'分钟';
												}
													
													
												},
												{"sTitle" : "通知规则","mData" : "notify_rule_name" },
												{"sTitle" : "状态","mData" : "status","mRender" : function(data,type,row) {
													 var res=['任务加载中','检测中','正常','警告','发生错误','过期']
													  return res[data];
												}
													
                                                 },
												{"sTitle" : "状态信息","mData" : "statusinfo" },
											//	{"sTitle" : "ccs检测","mData" : "ccs_check" },
											//	{"sTitle" : "hsts检测","mData" : "hsts_check" },
											//	{"sTitle" : "heartbleed检测","mData" : "heartbleed_check" },
												{"sTitle" : "创建时间","mData" : "create_time"},
												{"sTitle" : "","mData" : "id","mRender" : function(data,type,row) {
													
													res= "<a class=\"btn btn-xs btn-success\" href=\"/project/report?id="+data+"\"><i class=\"icon-lemon\"></i>查看</a>";
												    res+="<button class=\"btn btn-xs btn-delete\" onclick=\"projectdel('"+data+"')\"><i class=\"icon-trash\"></i>删除</button>";
												    return res;
												}
											},
												{"sTitle" : "","mData" : "id"},
											  ]
									});

				});

	};
 
 
	getprojects();  
	
 
		
		</script>
	<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>

